package com.yunhe.entity;

import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinColumns;
import javax.persistence.OneToMany;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;

/**
 * 投票内容实体类
 * */
@Entity
@Table(name="vote_subject")
public class Subject {
	//编号
		@Id
		@SequenceGenerator(name="SEQ_VOTE_OPTION",sequenceName="SEQ_VOTE_OPTION",allocationSize=1)
		@GeneratedValue(strategy=GenerationType.SEQUENCE,generator="SEQ_VOTE_OPTION")
		@Column(name="vs_id")
	private Integer vs_id;
		//投票内容
		@Column(name = "vs_title")
	private String vs_title;
		//投票类型.1单选,2多选
		@Column(name = "vs_type")
	private Integer vs_type;
		@OneToMany(fetch=FetchType.EAGER,targetEntity=Option.class,cascade={
			CascadeType.PERSIST,CascadeType.REMOVE,CascadeType.MERGE,CascadeType.REFRESH
		})
		@JoinColumns(value={@JoinColumn(name="vs_id",referencedColumnName="vs_id")})
	private List<Option> options;
		@OneToMany(fetch=FetchType.EAGER,targetEntity=Item.class,cascade={
			CascadeType.PERSIST,CascadeType.REMOVE,CascadeType.MERGE,CascadeType.REFRESH
		})
		@JoinColumns(value={@JoinColumn(name="vs_id",referencedColumnName="vs_id")})
	private List<Item> items;
		
		
		public List<Option> getOptions() {
			return options;
		}
		public void setOptions(List<Option> options) {
			this.options = options;
		}
		public List<Item> getItems() {
			return items;
		}
		public void setItems(List<Item> items) {
			this.items = items;
		}
		public Integer getVs_id() {
			return vs_id;
		}
		public void setVs_id(Integer vs_id) {
			this.vs_id = vs_id;
		}
		public String getVs_title() {
			return vs_title;
		}
		public void setVs_title(String vs_title) {
			this.vs_title = vs_title;
		}
		public Integer getVs_type() {
			return vs_type;
		}
		public void setVs_type(Integer vs_type) {
			this.vs_type = vs_type;
		}
		
}
